package cl.yapal.inventory.core;

import cl.yapal.inventory.dao.DaoException;
import cl.yapal.inventory.dao.DatabaseAccess;
import cl.yapal.inventory.vo.Product;

public class ServiceImpl implements Service {

    private DatabaseAccess databaseAccess;

    /**
     *
     * @param product
     * @throws InventoryException
     */
    public void addProduct(Product product) throws InventoryException {

        try {

            databaseAccess.addProduct(product);

        } catch (DaoException e) {
            throw new InventoryException(e);
        }

    }

    /**
     *
     * @param productCode
     * @return
     * @throws InventoryException
     */

    public Product searchProduct(String productCode) throws InventoryException {
        return null;
    }

    /**
     *
     * @param productCode
     * @param quantity
     * @throws InventoryException
     */
    public void decreaseProduct(String productCode, int quantity) throws InventoryException {
        Product product = searchProduct(productCode);

        product.

    }

    /**
     *
     * @param productCode
     * @param quantity
     * @throws InventoryException
     */

    public void increaseProduct(String productCode, int quantity) throws InventoryException {

    }

    /**
     *
     * @param databaseAccess
     */
    public void setDatabaseAccess(DatabaseAccess databaseAccess) {
        this.databaseAccess = databaseAccess;
    }
}
